package com.springcloud.sc.ucpv5.tree;

import lombok.Data;

@Data
public class InfoTree extends TreeNode implements Comparable<InfoTree> {
	private String name;
	private String physicsNodeNumber;
	private int typeChild;

	@Override
	public int compareTo(InfoTree infoTree) {

		int userTypediff = infoTree.getTypeChild() - this.getTypeChild();
		int diff = this.getPriority() - infoTree.getPriority();
		if(userTypediff>0){
			return 1;
		}else if(userTypediff<0){
			return -1;
		}else if(diff > 0){
			return 1;
		}else if(diff < 0){
			return -1;
		}else if(infoTree.getNodeNumber().equals( this.getNodeNumber() )){
			return 1;
		}
		return 0;
	}
}
